<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>上传测试</title>
    <link rel="stylesheet" type="text/css" href="https://www.layuicdn.com/layui/css/layui.css" />
    <script src="https://www.layuicdn.com/layui/layui.js"></script>
</head>
<body>
<div style="font-size: 24px;font-weight: 700;text-align: center;padding: 20px">文件上传测试</div>
<button type="button" class="layui-btn" id="test1">
    <i class="layui-icon">&#xe67c;</i>上传图片
</button>
<a href="{:addons_url('upyunup://admin_index/downloads')}" class="layui-btn">下载文件</a>
<ul class="img-list">
    <li class="img-list-item">
        <img style="max-width: 100%" src="" alt="">
    </li>
</ul>
<script>
    layui.use(['upload','jquery'], function(){
        var upload = layui.upload;
        var $ = layui.jquery;
        var uploadInst = upload.render({
            elem: '#test1'
            ,multiple: true
            ,url: '{:addons_url("upyunup://admin_index/upfile")}'
            ,done: function(res){
                $(".img-list .img-list-item img").attr("src",res.data.preview_url)
            }
            ,error: function(){
            }
        });
    });
</script>
</body>
</html>